<script setup lang="ts">
import { ref } from "vue";
import ReCol from "@/components/ReCol";
import { catalogueFormRules } from "./utils/rule";
import { CatalogueFormProps } from "./utils/types";

const props = withDefaults(defineProps<CatalogueFormProps>(), {
  formInline: () => ({
    id: null,
    name: ""
  })
});

const ruleFormRef = ref();
const newFormInline = ref(props.formInline);

function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });
</script>

<template>
  <el-form
    ref="ruleFormRef"
    :model="newFormInline"
    :rules="catalogueFormRules"
    label-width="100px"
  >
    <el-row :gutter="30">
      <re-col :value="24" :xs="24" :sm="24">
        <el-form-item label="目录名称:" prop="name">
          <el-input
            v-model="newFormInline.name"
            clearable
            maxlength="50"
            placeholder="请输入"
            show-word-limit
          />
        </el-form-item>
      </re-col>
    </el-row>
  </el-form>
</template>
